package com.xzhuang.task.service;

import java.util.List;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Service;

import com.xzhuang.task.quartz.ScheduleTask;

@Service
public interface TaskService {

	/***
	 * 添加一个任务
	 * 
	 * @throws Exception
	 */
	public void addTask(ScheduleTask task) throws Exception;

	/***
	 * 删除一个任务
	 * 
	 * @throws Exception
	 */

	public void deleteTask(ScheduleTask task,String defaultGroupName) throws Exception;

	/***
	 * 更新任务执行时间的表达式
	 * 
	 * @throws Exception
	 */
	public void updateTaskTrigger(ScheduleTask task) throws Exception;

	/***
	 * 
	 * @return 恢复一个任务
	 * @throws Exception
	 */
	public void resumeTask(ScheduleTask task) throws Exception;

	/***
	 * 暂停一个任务
	 * 
	 * @return
	 * @throws Exception
	 */
	public void pauseTask(ScheduleTask task) throws Exception;

	/**
	 * 
	 * @return
	 * @throws Exception
	 */
	public List<ScheduleTask> findExeTaskList() throws Exception;

	/***
	 * 
	 * @return
	 * @throws SchedulerException
	 */
	public List<ScheduleTask> getRunningJob() throws SchedulerException;

	public void runAJobNow(ScheduleTask scheduleJob) throws SchedulerException;

	public Scheduler getScheduler();

}
